package day17;

import java.util.HashMap;
import java.util.Scanner;

/**
 * @author tongchen
 * @create 2023-03-23 23:26
 */
public class Main1 {
    public static void main(String[] args) {
        //创建输入
        Scanner scanner=new Scanner(System.in);
        String s=scanner.nextLine();
        String s1=scanner.nextLine();
        char[] chars1 = s1.toCharArray();
        if(chars1[0]>=65&&chars1[0]<=90){
            chars1[0]= (char) (chars1[0]+32);
        }
        char[] chars = s.toCharArray();

        //将String转化为小写
        for(int i=0;i< chars.length;++i){
            if(chars[i]>=65&&chars[i]<=90){
              chars[i]= (char) (chars[i]+32);
            }
        }
        //创建hashmap
        HashMap<Character, Integer> map = new HashMap<>();
        for(Character character :chars){
            map.put(character,map.getOrDefault(character, 0)+1);
        }
        System.out.println(map.get(chars1[0]));
    }

}
